package com.baidu.a.a.a.a.b;

import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Process;
import android.os.SystemClock;
import android.provider.Settings;
import android.system.ErrnoException;
import android.system.Os;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.CharArrayWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.security.PublicKey;
import java.security.cert.CertificateFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import javax.crypto.Cipher;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class c {
    private static final String a;
    private final Context b;
    private int c = 0;
    private PublicKey d;
    private static bb e;

    private c(Context paramContext)
    {
        this.b = paramContext.getApplicationContext();
        a();
    }

    private static String a(byte[] paramArrayOfByte) {
        if (paramArrayOfByte == null) {
            throw new IllegalArgumentException("Argument b ( byte array ) is null! ");
        }
        String str1 = "";
        String str2 = null;
        for (int i = 0; i < paramArrayOfByte.length; i++) {
            if ((str2 = Integer.toHexString(paramArrayOfByte[i] & 0xFF)).length() == 1) {
                str1 = str1 + "0" + str2;
            } else {
                str1 = str1 + str2;
            }
        }
        return str1.toLowerCase();
    }

    private String[] a(Signature[] paramArrayOfSignature) {
        String[] arrayOfString = new String[paramArrayOfSignature.length];
        for (int i = 0; i < arrayOfString.length; i++) {
            arrayOfString[i] = a(com.baidu.a.a.a.a.a.d.a(paramArrayOfSignature[i].toByteArray()));
        }
        return arrayOfString;
    }

    private static byte[] a(byte[] paramArrayOfByte, PublicKey paramPublicKey)
            throws Exception
    {
        Cipher localCipher;
        (localCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding")).init(2, paramPublicKey);
        return localCipher.doFinal(paramArrayOfByte);
    }

    private void a() {
        ByteArrayInputStream v0_2 = null;
        try {
            v0_2 = new ByteArrayInputStream(com.baidu.a.a.a.a.b.b.a());
            this.d = CertificateFactory.getInstance("X.509").generateCertificate((v0_2))
                    .getPublicKey();
            try {
                v0_2.close();
                return;
            } catch (Exception e) {
                b(e);
                return;
            }
        } catch (Exception localException1) {
            if (v0_2 != null) {
                try {
                    v0_2.close();
                    return;
                } catch (Exception localException4) {
                    b(localException4);
                    return;
                }
            }
        }finally {
            if (v0_2 != null) {
                try {
                    v0_2.close();
                } catch (Exception e) {
                    b(e);
                }
            }
        }
    }

    private List a(Intent paramIntent, boolean paramBoolean) {
        ArrayList v3 = new ArrayList();
        PackageManager v4 = this.b.getPackageManager();
        List v0 = v4.queryBroadcastReceivers(paramIntent, 0);
        if (v0 != null) {
            Iterator v5 = v0.iterator();
            while (v5.hasNext()) {
                ResolveInfo resolveInfo = (ResolveInfo) v5.next();
                if (resolveInfo.activityInfo != null && (resolveInfo.activityInfo.applicationInfo != null)) {
                    try {

                        @SuppressLint("WrongConstant")
                        Bundle v6 = v4.getReceiverInfo(new ComponentName(resolveInfo.activityInfo
                                .packageName, (resolveInfo).activityInfo.name), 128).metaData;

                        String v7 = v6.getString("galaxy_data");
                        if(v6 != null && !TextUtils.isEmpty((v7))){
                            byte[] v7_1 = com.baidu.a.a.a.a.a.b.a(v7.getBytes("utf-8"));
                            JSONObject v9 = new JSONObject(new String(v7_1));
                            com.baidu.a.a.a.a.b.c.a v8 = new com.baidu.a.a.a.a.b.c.a(null);
                            v8.b = v9.getInt("priority");
                            v8.a = resolveInfo.activityInfo.applicationInfo;
                            if(this.b.getPackageName().equals(resolveInfo.activityInfo.applicationInfo
                                    .packageName)) {
                                v8.d = true;
                            }
                            if(paramBoolean){
                                String v6_1 = v6.getString("galaxy_sf");
                                if(!TextUtils.isEmpty(((CharSequence)v6_1))) {
                                    @SuppressLint("WrongConstant")
                                    PackageInfo v10 = v4.getPackageInfo(resolveInfo.activityInfo.applicationInfo
                                            .packageName, 64);
                                    JSONArray v9_1 = v9.getJSONArray("sigs");
                                    String[] v11 = new String[v9_1.length()];
                                    int v0_3;
                                    for(v0_3 = 0; v0_3 < v11.length; ++v0_3) {
                                        v11[v0_3] = v9_1.getString(v0_3);
                                    }
                                    if(this.a(v11, this.a(v10.signatures))) {
                                        byte[] v0_4 = com.baidu.a.a.a.a.b.c.a(com.baidu.a.a.a.a.a.b.a(v6_1.getBytes()), this.d);
                                        byte[] v6_2 = com.baidu.a.a.a.a.a.d.a(v7_1);
                                        int i;
                                        if ((i = (v0_4 != null) && (Arrays.equals((byte[])(v0_4), (byte[])v6_2)) ? 1 : 0) != 0) {
                                            v8.c = true;
                                        }
                                    }
                                }
                            }
                            v3.add(v8);
                        }
                    }
                    catch (Exception localException) {}
                }
            }
        }
        Collections.sort(((List)v3), new d(this));
        return v3;
    }

    private boolean a(String[] arg6, String[] arg7) {
        if ((arg6 == null) || (arg7 == null) || (arg6.length != arg7.length)) {
            return false;
        }
        HashSet localHashSet = new HashSet();
        int i = arg6.length;
        for (int j = 0; j < i; j++) {
            String str = arg6[j];
            localHashSet.add(str);
        }
        HashSet v1_1 = new HashSet();
        String[] arrayOfString;
        i = (arrayOfString = arg7).length;
        for (int k = 0; k < i; k++) {
            v1_1.add(arrayOfString[k]);
        }
        return localHashSet.equals(v1_1);
    }


    private boolean a(String arg7) {
        FileOutputStream v0_2 = null;
        FileOutputStream v3;
        boolean v2 = true;
        int v0 = Build.VERSION.SDK_INT >= 24 ? 0 : 1;
        try {
            v3 = this.b.openFileOutput("libcuid.so", v0);


        } catch(Exception v0_1) {
            try {
                v0_2.close();
            } catch(Exception e) {

            }
            return false;
        }

        try {
            v3.write(arg7.getBytes());
            v3.flush();
            if(v3 == null && v0 == 0) {
                v2 = c$c.a(new File(this.b.getFilesDir(), "libcuid.so").getAbsolutePath(),
                        436);
                return v2;
            }
            v3.close();
        } catch(Exception v0_1) {
            if(v0_2 != null) {
                try {
                    v0_2.close();
                }
                catch(Exception e) {
                }
            }
            return false;
        }

        if(v3 != null) {
            try {
                v3.close();
            }
            catch(Exception v1) {
            }
        }
        return v2;
    }

    private String b(String arg2) {
        String v0_1;
        try {
            v0_1 = Settings.System.getString(this.b.getContentResolver(), arg2);
        }
        catch(Exception v0) {
            v0_1 = null;
        }
        return v0_1;
    }

    private boolean a(String arg2, String arg3) {
        boolean v0_1;
        try {
            v0_1 = Settings.System.putString(this.b.getContentResolver(), arg2, arg3);
        }
        catch(Exception v0) {
            v0_1 = false;
        }

        return v0_1;
    }

    private static void b(Throwable paramThrowable) {}

    private static String a(File arg6) {
        Object localObject = null;
        int v1_2;
        FileReader v2;
        String v0 = null;
        try {
            v2 = new FileReader(arg6);
            v1_2 = 8192;
            char[] v1_3 = new char[v1_2];
            CharArrayWriter v3 = new CharArrayWriter();
            int i;
            while ((i = ((FileReader)localObject).read(v1_3)) > 0) {
                v3.write(v1_3, 0, i);
            }
            v0 = v3.toString();
            try {
                ((FileReader)localObject).close();
            } catch (Exception localException1)
            {
                b(localException1);
            }
            return v0;
        } catch (Exception localException2) {}finally {
            if (localObject != null) {
                try {
                    ((FileReader)localObject).close();
                } catch (Exception localException4) {
                    b(localException4);
                }
            }
        }
        return null;
    }

    public static String a(Context paramContext) {
        return e(paramContext).b();
    }

    private static bb e(Context paramContext) {
        if (e == null) {
            synchronized (bb.class)
            {
                if (e == null)
                {
                    SystemClock.uptimeMillis();
                    e = new com.baidu.a.a.a.a.b.c(paramContext).b();
                    SystemClock.uptimeMillis();
                }
            }
        }
        return e;
    }

    public static String b(Context paramContext) {
        return e(paramContext).a;
    }

    public static String c(Context paramContext) {
        return e(paramContext).b;
    }

    public static String d(Context arg2) {
        String v0 = Settings.Secure.getString(arg2.getContentResolver(), "android_id");
        if(TextUtils.isEmpty(((CharSequence)v0))) {
            v0 = "";
        }
        return v0;
    }

    private bb b() {
        boolean v0_3;
        boolean v1;
        Object v0_1;
        List v0 = this.a(new Intent("com.baidu.intent.action.GALAXY").setPackage(this.b.getPackageName()),
                true);
        com.baidu.a.a.a.a.b.d v4 = null;
        String v1_2 = null;
        bb v1_3;
        bb v0_5 = null;
        String v0_4;
        int v2 = 0;
        String v4_1 = null;
        if(v0 == null || v0.size() == 0) {
            for (int j = 0; j < 3; j++) {
                Log.w("DeviceId", "galaxy lib host missing meta-data,make sure you know the right way to integrate galaxy");
            }
            v0_3 = false;
        } else {
            v0_1 = v0.get(0);
            v1 = ((a)v0_1).c;
            if(!((a)v0_1).c) {
                for (int k = 0; k < 3; k++) {
                    Log.w("DeviceId", "galaxy config err, In the release version of the signature should be matched");
                }
            }


            v0_3 = v1;
        }

        File v1_1 = new File(this.b.getFilesDir(), "libcuid.so");
        //Todo 这边可能有问题
        bb v3 = v1_1.exists() ? bb.a(com.baidu.a.a.a.a.b.c.f(com.baidu.a.a.a.a.b.c.a(v1_1))) : (null);
        if (v3 == null) {
            this.c |= 0x10;
            List v6 = this.a(new Intent("com.baidu.intent.action.GALAXY"), v0_3);
            if(v6 != null) {
                String str = "files";
                v1_1 = this.b.getFilesDir();
                if(!str.equals(v1_1.getName())) {
                    Log.e("DeviceId", "fetal error:: app files dir name is unexpectedly :: " + v1_1.
                            getAbsolutePath());
                    v1_2 = v1_1.getName();
                }
                Iterator v6_1 = v6.iterator();

                while(true) {
                    if(!v6_1.hasNext()) {
                        break;
                    }

                    v0_1 = v6_1.next();
                    if(((a)v0_1).d) {
                        continue;
                    }

                    File v7_1 = new File(new File(((a)v0_1).a.dataDir, v1_2), "libcuid.so");
                    if(v7_1.exists()) {
                        v0_5 = bb.a(com.baidu.a.a.a.a.b.c.f(com.baidu.a.a.a.a.b.c.a(v7_1)));
                        if(v0_5 != null) {
                            break;
                        }
                    }
                    else {
                        v0_5 = v3;
                    }

                    v3 = v0_5;
                }
            }

        }

        if(v0_5 == null) {
            v0_5 = bb.a(com.baidu.a.a.a.a.b.c.f(this.b("com.baidu.deviceid.v2")));
        }

        boolean v3_1 = this.c("android.permission.READ_EXTERNAL_STORAGE");
        if(v0_5 != null || !v3_1) {
            v1_3 = v0_5;
        }
        else {
            this.c |= 2;
            v1_3 = this.e();
        }

        if(v1_3 == null) {
            this.c |= 8;
            v1_3 = d();
        }

        if(v1_3 != null || !v3_1) {
            v0_4 = null;
        } else {
            this.c |= 1;
            v0_4 = this.h("");
            v1_3 = this.d(v0_4);
            v2 = 1;
        }


        if (v1_3 == null) {
            this.c |= 4;
            if(v2 == 0) {
                v0_4 = this.h("");
            }

            bb v2_1 = new bb(null);
            v1_2 = com.baidu.a.a.a.a.b.c.d(this.b);
            v1_2 = Build.VERSION.SDK_INT < 23 ? v0_4 + v1_2 + UUID.randomUUID().toString() : "com.baidu"
                    + v1_2;
            v2_1.a = com.baidu.a.a.a.a.a.c.a(v1_2.getBytes(), true);
            v2_1.b = v0_4;
            v0_5 = v2_1;
        } else {
            v0_5 = v1_3;
        }
        v1_1 = new File(this.b.getFilesDir(), "libcuid.so");
        if((this.c & 16) != 0 || !v1_1.exists()) {
            v1_2 = TextUtils.isEmpty(((CharSequence)v4)) ? e(v0_5.a()) : null;
            this.a(v1_2);
            v4_1 = v1_2;
        }
        v1 = this.c();
        if((v1) && ((this.c & 2) != 0 || (TextUtils.isEmpty(this.b("com.baidu.deviceid.v2"))))) {
            if(TextUtils.isEmpty(((CharSequence)v4_1))) {
                v4_1 = e(v0_5.a());
            }

            this.a("com.baidu.deviceid.v2", v4_1);
        }

        if (c("android.permission.WRITE_EXTERNAL_STORAGE")) {
            File v2_2 = new File(Environment.getExternalStorageDirectory(), "backups/.SystemConfig/.cuid2");
            if (((this.c & 0x8) != 0) || (!v2_2.exists())) {
                if(TextUtils.isEmpty(((CharSequence)v4_1))) {
                    v4_1 = e(v0_5.a());
                }
                g(v4_1);
            }
        }

        if((v1) && ((this.c & 1) != 0 || (TextUtils.isEmpty(this.b("com.baidu.deviceid"))))) {
            this.a("com.baidu.deviceid", v0_5.a);
            this.a("bd_setting_i", v0_5.b);
        }

        if((v1) && !TextUtils.isEmpty(v0_5.b)) {
            v1_1 = new File(Environment.getExternalStorageDirectory(), "backups/.SystemConfig/.cuid");
            if((this.c & 2) == 0 && (v1_1.exists())) {
                return v0_5;
            }

            b(v0_5.b, v0_5.a);
        }

        return v0_5;
    }

    private boolean c()
    {
        return c("android.permission.WRITE_SETTINGS");
    }

    @SuppressLint("WrongConstant")
    private boolean c(String paramString) {
        return this.b.checkPermission(paramString, Process.myPid(), Process.myUid()) == 0;
    }

    private bb d() {
        bb  v0_1;
        String v1 = this.b("com.baidu.deviceid");
        String v0 = this.b("bd_setting_i");
        if(TextUtils.isEmpty(((CharSequence)v0))) {
            v0 = this.h("");
            if(!TextUtils.isEmpty(((CharSequence)v0))) {
                this.a("bd_setting_i", v0);
            }
        }

        if(TextUtils.isEmpty(((CharSequence)v1))) {
            v1 = this.b(com.baidu.a.a.a.a.a.c.a(("com.baidu" + v0 + com.baidu.a.a.a.a.b.c.d(this.b)).getBytes(), true));
        }

        if(!TextUtils.isEmpty(((CharSequence)v1))) {
            bb  v2 = new bb(null);
            v2.a = v1;
            v2.b = v0;
            v0_1 = v2;
        }
        else {
            v0_1 = ((bb)null);
        }

        return v0_1;
    }

    private bb e() {
        File v0 = new File(Environment.getExternalStorageDirectory(), "backups/.SystemConfig/.cuid2");
        if(v0.exists()) {
            String v0_1 = a(v0);
            if(TextUtils.isEmpty(((CharSequence)v0_1))) {
                return null;
            }

            try {
                bb v0_3 = bb.a(new String(com.baidu.a.a.a.a.a.a.b(a, a, com.baidu.a.a.a.a.a.b.a(v0_1
                        .getBytes()))));
                return v0_3;
            }
            catch(Exception v0_2) {
                v0_2.printStackTrace();
            }
        }

        return null;
    }
    //TODO 需要关注
    private bb d(String arg9) {
        String v1_6 = null;
        bb v0;
        d v2 = null;
        int v3 = 1;
        int v5 = Build.VERSION.SDK_INT < 23 ? 1 : 0;
        if(v5 != 0 && (TextUtils.isEmpty(((CharSequence)arg9)))) {
            v0 = null;
            return v0;
        }

        String v0_1 = "";
        File v1 = new File(Environment.getExternalStorageDirectory(), "baidu/.cuid");
        if(!v1.exists()) {
            v1 = new File(Environment.getExternalStorageDirectory(), "backups/.SystemConfig/.cuid");
        }
        else {
            v3 = 0;
        }

        try {
            BufferedReader v1_4 = new BufferedReader(new FileReader(v1));
            StringBuilder v4 = new StringBuilder();
            while (true) {
                String v6 = v1_4.readLine();
                if (v6 == null) {
                    break;
                }

                v4.append(v6);
                v4.append("\r\n");
            }

            v1_4.close();
            String[] v1_5 = new String(com.baidu.a.a.a.a.a.a.b(a, a, com.baidu.a.a.a.a.a.b.a(v4.
                    toString().getBytes()))).split("=");
            if(v1_5 != null && v1_5.length != 2){
                if(v5 == 0 || !arg9.equals(v1_5[0])) {
                    if (v5 == 0 && !TextUtils.isEmpty(((CharSequence) arg9))) {
                        arg9 = v1_5[1];
                    }

                    v0_1 = v1_5[1];
                    v1_6 = arg9;
                }else{
                    v1_6 = arg9;
                }
            }

            v1_6 = arg9;
            if(v3 == 0){
                b(v1_6, v0_1);
            }
        }catch(Exception v1_3) {
            v1_6 = arg9;
        }

        if(!TextUtils.isEmpty(((CharSequence)v0_1))) {
            bb v3_4 = new bb(v2);
            v3_4.a = v0_1;
            v3_4.b = v1_6;
            v0 = v3_4;
        }
        else {
            v0 = null;
        }
        return v0;
    }


    private static String e(String arg3) {
        if(TextUtils.isEmpty(((CharSequence)arg3))) {
            String v0 = null;
            return v0;
        }

        try {
            return com.baidu.a.a.a.a.a.b.a(com.baidu.a.a.a.a.a.a.a(a, a, arg3.getBytes()), "utf-8");
        }
        catch(Exception v0_1) {
        }

        return "";
    }


    private static String f(String arg4) {
        String v0;
        if(TextUtils.isEmpty(((CharSequence)arg4))) {
            v0 = null;
            return v0;
        }

        try {
            v0 = new String(com.baidu.a.a.a.a.a.a.b(a, a, com.baidu.a.a.a.a.a.b.a(arg4.getBytes())));
        }
        catch(Exception v0_1) {
            b(((Throwable)v0_1));
            v0 = "";
        }

        return v0;
    }

    private static void g(String arg8) {
        File v5;
        File v0 = new File(Environment.getExternalStorageDirectory(), "backups/.SystemConfig");
        File v1 = new File(v0, ".cuid2");
        try {
            if((v0.exists()) && !v0.isDirectory()) {
                Random v2 = new Random();
                File v3 = v0.getParentFile();
                String v4 = v0.getName();
                do {
                    v5 = new File(v3, v4 + v2.nextInt() + ".tmp");
                }
                while(v5.exists());

                v0.renameTo(v5);
                v5.delete();
            }

            v0.mkdirs();
            FileWriter v0_3 = new FileWriter(v1, false);
            v0_3.write(arg8);
            v0_3.flush();
            v0_3.close();
        }
        catch(Exception v0_1) {
        }
    }

    private static void b(String arg9, String arg10) {
        File v6;
        if(!TextUtils.isEmpty(((CharSequence)arg9))) {
            StringBuilder v0 = new StringBuilder();
            v0.append(arg9);
            v0.append("=");
            v0.append(arg10);
            File v1 = new File(Environment.getExternalStorageDirectory(), "backups/.SystemConfig");
            File v2 = new File(v1, ".cuid");
            try {
                if((v1.exists()) && !v1.isDirectory()) {
                    Random v3 = new Random();
                    File v4 = v1.getParentFile();
                    String v5 = v1.getName();
                    do {
                        v6 = new File(v4, v5 + v3.nextInt() + ".tmp");
                    }
                    while(v6.exists());

                    v1.renameTo(v6);
                    v6.delete();
                }

                v1.mkdirs();
                FileWriter v1_1 = new FileWriter(v2, false);
                v1_1.write(com.baidu.a.a.a.a.a.b.a(com.baidu.a.a.a.a.a.a.a(a, a, v0.toString().getBytes()),
                        "utf-8"));
                v1_1.flush();
                v1_1.close();
            }
            catch(Exception v0_1) {
            }
        }
    }

    @SuppressLint("WrongConstant")
    private String h(String paramString)
    {
        String str = null;
        try
        {
            TelephonyManager localTelephonyManager;
            if ((localTelephonyManager = (TelephonyManager)this.b.getSystemService("phone")) != null) {
                str = localTelephonyManager.getDeviceId();
            }
        }
        catch (Exception localException)
        {
            Log.e("DeviceId", "Read IMEI failed", localException);
        }
        if (TextUtils.isEmpty(str = i(str))) {
            str = paramString;
        }
        return str;
    }

    private static String i(String paramString)
    {
        if ((paramString != null) && (paramString.contains(":"))) {
            return "";
        }
        return paramString;
    }

    static
    {
        String str1 = new String(com.baidu.a.a.a.a.a.b.a(new byte[] { 77, 122, 65, 121, 77, 84, 73, 120, 77, 68, 73, 61 }));
        String str2 = new String(com.baidu.a.a.a.a.a.b.a(new byte[] { 90, 71, 108, 106, 100, 87, 82, 112, 89, 87, 73, 61 }));
        a = str1 + str2;
    }

    static class bb
    {
        public String a;
        public String b;
        public int c = 2;


        bb(d arg1) {
            super();
        }

        public static bb a(String arg5) {
            bb v0 = null;
            if(!TextUtils.isEmpty(((CharSequence)arg5))) {
                try {
                    JSONObject v1_1 = new JSONObject(arg5);
                    String v2 = v1_1.getString("deviceid");
                    String v3 = v1_1.getString("imei");
                    int v4 = v1_1.getInt("ver");
                    if(TextUtils.isEmpty(((CharSequence)v2))) {
                        return v0;
                    }

                    if(v3 == null) {
                        return v0;
                    }

                    bb v1_2 = new bb(null);
                    v1_2.a = v2;
                    v1_2.b = v3;
                    v1_2.c = v4;
                    v0 = v1_2;
                }
                catch(JSONException v1) {
                    com.baidu.a.a.a.a.b.c.a(((Throwable)v1));
                }
            }

            return v0;
        }

        public String a() {
            String v0_1;
            try {
                v0_1 = new JSONObject().put("deviceid", this.a).put("imei", this.b).put("ver", this.
                        c).toString();
            }
            catch(JSONException v0) {
                com.baidu.a.a.a.a.b.c.a(((Throwable)v0));
                v0_1 = null;
            }

            return v0_1;
        }


        public String b() {
            String v0 = this.b;
            if(TextUtils.isEmpty(((CharSequence)v0))) {
                v0 = "0";
            }

            return this.a + "|" + new StringBuffer(v0).reverse().toString();
        }

    }

    static class a {
        public ApplicationInfo a;
        public int b = 0;
        public boolean c = false;
        public boolean d = false;

        a(d arg1) {
            super();
        }

        private a() {
            super();
            this.b = 0;
            this.c = false;
            this.d = false;
        }
    }

    static class c$c {
        @SuppressLint("NewApi")
        static boolean a(String arg1, int arg2) {
            boolean v0_1;
            try {
                Os.chmod(arg1, arg2);
                v0_1 = true;
            }
            catch(ErrnoException v0) {
                com.baidu.a.a.a.a.b.c.a(((Throwable)v0));
                v0_1 = false;
            }

            return v0_1;
        }
    }

    static void a(Throwable arg0) {
    }
}
